home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / lazercmd.c < prev    next >
C/C++ Source or Header  |  2000-05-20  |  21KB  |  714 lines

  1. /***************************************************************************
  2.   Lazer Command memory map (preliminary)
  3.  
  4.   driver by Juergen Buchmueller
  5.  
  6.   0000-0bff ROM
  7.  
  8.   1c00-1c1f RAM     CPU scratch pad is first 32 bytes of video RAM(not displayed)
  9.  
  10.   1c20-1eff RAM     video buffer
  11.             xxxx    D0 - D5 character select
  12.                     D6        horz line below character (row #9)
  13.                     D7        vert line right of character (bit #0)
  14.  
  15.   1f00-1f03         R/W hardware
  16.  
  17.             1f00 W       audio channels
  18.                     D4 gun fire
  19.                     D5 explosion
  20.                     D6 tank engine
  21.                     D7 running man
  22.             1f00 R       player 1 joystick
  23.                     D0 up
  24.                     D1 down
  25.                     D2 right
  26.                     D3 left
  27.  
  28.             1f01 W    D0 - D7 marker y position
  29.             1f01 R       player 2 joystick
  30.                     D0 up
  31.                     D1 down
  32.                     D2 right
  33.                     D3 left
  34.  
  35.             1f02 W    D0 - D7 marker x position
  36.             1f02 R       player 1 + 2 buttons
  37.                     D0 button 1 player 2
  38.                     D1 button 1 player 1
  39.                     D2 button 2 player 2
  40.                     D3 button 2 player 1
  41.  
  42.             1f03 W        attract mode
  43.                     D0 toggle on attract mode
  44.                        (attract mode switched off by coin detected)
  45.                     D4 clear coin detected toggle
  46.             1f03 R        coinage, coin detected and start buttons
  47.                     D0 coin 1/2 (DIP switch 4)
  48.                     D1 start 'expert'
  49.                     D2 start 'novice'
  50.                     D3 coin detected
  51.  
  52.   1f04-1f07            Read only hardware
  53.  
  54.             1f04 R       vertical scan counter
  55.                     D0 60 Hz
  56.                     D1 120 Hz
  57.                     D2 240 Hz
  58.                     D3 480 Hz
  59.  
  60.             1f05 R       vertical scan counter
  61.                     D0 7.860 KHz
  62.                     D1 3.960 KHz
  63.                     D2 1.980 KHz
  64.                     D3 960 Hz
  65.  
  66.             1f06 R  D0 - D7 readback of marker x position
  67.  
  68.             1f07 R    D0 - D7 readback of marker y position
  69.  
  70.   I/O ports:
  71.  
  72.   'data'         R            game time
  73.                     D0 - D1 60,90,120,180 seconds (DIP switch 1 - 2)
  74.  
  75. ***************************************************************************/
  76.  
  77. /***************************************************************************
  78.   Meadows Lanes memory map (preliminary)
  79.  
  80.   0000-0bff ROM
  81.  
  82.   0c00-0c1f RAM     CPU scratch pad is first 32 bytes of video RAM(not displayed)
  83.  
  84.   0c20-0eff RAM     video buffer
  85.             xxxx    D0 - D5 character select
  86.                     D6        horz line below character (row #9)
  87.                     D7        vert line right of character (bit #0)
  88.  
  89.   1000-17ff ROM
  90.  
  91.   1f00-1f03         R/W hardware
  92.  
  93.             1f00 W       audio control bits
  94.                     D0 - D3 not used
  95.                     D4 bowl and hit
  96.                     D5 hit
  97.                     D6 - D7 not used
  98.             1f00 R       bowl ball
  99.                     D0 fast
  100.                     D1 slow
  101.                        joystick
  102.                     D2 right
  103.                     D3 left
  104.  
  105.             1f01 W    D0 - D7 marker y position
  106.             1f01 R       hook control
  107.                     D0 left
  108.                     D1 right
  109.                     D2 - D3 not used
  110.  
  111.             1f02 W    D0 - D7 marker x position
  112.             1f02 R    D0 - D3 not used
  113.  
  114.             1f03 W        attract mode
  115.                     D0 toggle on attract mode
  116.                        (attract mode switched off by coin detected)
  117.                     D4 clear coin detected toggle
  118.                     D5 can be jumpered to control inverse video
  119.                     D6 - D7 not used
  120.             1f03 R        coinage, coin detected and start buttons
  121.                     D0 coin 1/2 (DIP switch 4)
  122.                     D1 start
  123.                     D2 not used
  124.                     D3 coin detected
  125.  
  126.   1f04-1f07            Read only hardware
  127.  
  128.             1f04 R       vertical scan counter
  129.                     D0 60 Hz
  130.                     D1 120 Hz
  131.                     D2 240 Hz
  132.                     D3 480 Hz
  133.  
  134.             1f05 R       vertical scan counter
  135.                     D0 7.860 KHz
  136.                     D1 3.960 KHz
  137.                     D2 1.980 KHz
  138.                     D3 960 Hz
  139.  
  140.             1f06 R  D0 - D7 readback of marker x position
  141.  
  142.             1f07 R    D0 - D7 readback of marker y position
  143.  
  144.   I/O ports:
  145.  
  146.   'data'         R            game time
  147.                     D0 time on     (DIP switch 1)
  148.                     D1 3,5 seconds (DIP switch 2)
  149.  
  150. ***************************************************************************/
  151.  
  152. #include "driver.h"
  153. #include "vidhrdw/generic.h"
  154. #include "vidhrdw/lazercmd.h"
  155. #include "cpu/s2650/s2650.h"
  156.  
  157.  
  158. int marker_x, marker_y;
  159.  
  160.  
  161. /*************************************************************
  162.  
  163.    externals
  164.  
  165.  *************************************************************/
  166. int lazercmd_vh_start(void);
  167. void lazercmd_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  168. void lazercmd_marker_dirty(int marker);
  169.  
  170. /*************************************************************
  171.  *
  172.  * Statics
  173.  *
  174.  *************************************************************/
  175. static int timer_count = 0;
  176.  
  177. /*************************************************************
  178.  * Interrupt for the cpu
  179.  * Fake something toggling the sense input line of the S2650
  180.  * The rate should be at about 1 Hz
  181.  *************************************************************/
  182. static int lazercmd_timer(void)
  183. {
  184.     static int sense_state = 0;
  185.  
  186.     if( ++timer_count >= 64*128 ) {
  187.         timer_count = 0;
  188.         sense_state ^= 1;
  189.         cpu_set_irq_line( 0, 1, (sense_state) ? ASSERT_LINE : CLEAR_LINE );
  190.     }
  191.     return ignore_interrupt();
  192. }
  193.  
  194. /*************************************************************
  195.  *
  196.  * IO port read/write
  197.  *
  198.  *************************************************************/
  199.  
  200. /* triggered by WRTC,r opcode */
  201. static WRITE_HANDLER( lazercmd_ctrl_port_w )
  202. {
  203. }
  204.  
  205. /* triggered by REDC,r opcode */
  206. static READ_HANDLER( lazercmd_ctrl_port_r )
  207. {
  208.     int data = 0;
  209.     return data;
  210. }
  211.  
  212. /* triggered by WRTD,r opcode */
  213. static WRITE_HANDLER( lazercmd_data_port_w )
  214. {
  215. }
  216.  
  217. /* triggered by REDD,r opcode */
  218. static READ_HANDLER( lazercmd_data_port_r )
  219. {
  220.     int data;
  221.     data = input_port_2_r(0) & 0x0f;
  222.     return data;
  223. }
  224.  
  225. static WRITE_HANDLER( lazercmd_hardware_w )
  226. {
  227.     static int DAC_data = 0;
  228.  
  229.     switch (offset)
  230.     {
  231.         case 0: /* audio channels */
  232.             DAC_data=(data&0x80)^((data&0x40)<<1)^((data&0x20)<<2)^((data&0x10)<<3);
  233.             if (DAC_data)
  234.             {
  235.                 DAC_data_w(0, 0xff);
  236.             }
  237.             else
  238.             {
  239.                 DAC_data_w(0, 0);
  240.             }
  241.             break;
  242.         case 1: /* marker Y position */
  243.             lazercmd_marker_dirty(0); /* mark old position dirty */
  244.             marker_y = data;
  245.             break;
  246.         case 2: /* marker X position */
  247.             lazercmd_marker_dirty(0); /* mark old position dirty */
  248.             marker_x = data;
  249.             break;
  250.         case 3: /* D4 clears coin detected and D0 toggles on attract mode */
  251.             break;
  252.     }
  253. }
  254.  
  255. static WRITE_HANDLER( medlanes_hardware_w )
  256. {
  257.     static int DAC_data = 0;
  258.  
  259.     switch (offset)
  260.     {
  261.         case 0: /* audio control */
  262.             /* bits 4 and 5 are used to control a sound board */
  263.             /* these could be used to control sound samples */
  264.             /* at the moment they are routed through the dac */
  265.             DAC_data=((data&0x20)<<2)^((data&0x10)<<3);
  266.             if (DAC_data)
  267.             {
  268.                 DAC_data_w(0, 0xff);
  269.             }
  270.             else
  271.             {
  272.                 DAC_data_w(0, 0);
  273.             }
  274.             break;
  275.         case 1: /* marker Y position */
  276.             lazercmd_marker_dirty(0); /* mark old position dirty */
  277.             marker_y = data;
  278.             break;
  279.         case 2: /* marker X position */
  280.             lazercmd_marker_dirty(0); /* mark old position dirty */
  281.             marker_x = data;
  282.             break;
  283.         case 3: /* D4 clears coin detected and D0 toggles on attract mode */
  284.             break;
  285.     }
  286. }
  287.  
  288. static READ_HANDLER( lazercmd_hardware_r )
  289. {
  290.     int data = 0;
  291.  
  292.     switch (offset)
  293.     {
  294.         case 0:                   /* player 1 joysticks */
  295.             data = input_port_0_r(0);
  296.             break;
  297.         case 1:                   /* player 2 joysticks */
  298.             data = input_port_1_r(0);
  299.             break;
  300.         case 2:                   /* player 1 + 2 buttons */
  301.             data = input_port_4_r(0);
  302.             break;
  303.         case 3:                   /* coin slot + start buttons */
  304.             data = input_port_3_r(0);
  305.             break;
  306.         case 4:                   /* vertical scan counter */
  307.             data = ((timer_count&0x10)>>1)|((timer_count&0x20)>>3)|((timer_count&0x40)>>5)|((timer_count&0x80)>>7);
  308.             break;
  309.         case 5:                   /* vertical scan counter */
  310.             data = timer_count & 0x0f;
  311.             break;
  312.         case 6:                   /* 1f02 readback */
  313.             data = marker_x;
  314.             break;
  315.         case 7:                   /* 1f01 readback */
  316.             data = marker_y;
  317.             break;
  318.     }
  319.     return data;
  320. }
  321.  
  322. static struct MemoryWriteAddress lazercmd_writemem[] =
  323. {
  324.     { 0x0000, 0x0bff, MWA_ROM },
  325.     { 0x1c20, 0x1eff, videoram_w, &videoram, &videoram_size },
  326.     { 0x1f00, 0x1f03, lazercmd_hardware_w },
  327.     { -1 }                       /* end of table */
  328. };
  329.  
  330. static struct MemoryReadAddress lazercmd_readmem[] =
  331. {
  332.     { 0x0000, 0x0bff, MRA_ROM },
  333.     { 0x1c20, 0x1eff, MRA_RAM },
  334.     { 0x1f00, 0x1f03, lazercmd_hardware_r },
  335.     { -1 }                       /* end of table */
  336. };
  337.  
  338. static struct MemoryWriteAddress medlanes_writemem[] =
  339. {
  340.     { 0x0000, 0x0bff, MWA_ROM },
  341.     { 0x1000, 0x1800, MWA_ROM },
  342.     { 0x1c20, 0x1eff, videoram_w, &videoram, &videoram_size },
  343.     { 0x1f00, 0x1f03, medlanes_hardware_w },
  344.     { -1 }                       /* end of table */
  345. };
  346.  
  347. static struct MemoryReadAddress medlanes_readmem[] =
  348. {
  349.     { 0x0000, 0x0bff, MRA_ROM },
  350.     { 0x1000, 0x1800, MRA_ROM },
  351.     { 0x1c20, 0x1eff, MRA_RAM },
  352.     { 0x1f00, 0x1f03, lazercmd_hardware_r },
  353.     { -1 }                       /* end of table */
  354. };
  355.  
  356. static struct IOWritePort lazercmd_writeport[] =
  357. {
  358.     { S2650_CTRL_PORT, S2650_CTRL_PORT, lazercmd_ctrl_port_w },
  359.     { S2650_DATA_PORT, S2650_DATA_PORT, lazercmd_data_port_w },
  360.     { -1 }                       /* end of table */
  361. };
  362.  
  363. static struct IOReadPort lazercmd_readport[] =
  364. {
  365.     { S2650_CTRL_PORT, S2650_CTRL_PORT, lazercmd_ctrl_port_r },
  366.     { S2650_DATA_PORT, S2650_DATA_PORT, lazercmd_data_port_r },
  367.     { -1 }                       /* end of table */
  368. };
  369.  
  370.  
  371. INPUT_PORTS_START( lazercmd )
  372.     PORT_START                       /* IN0 player 1 controls */
  373.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER1 )
  374.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER1 )
  375.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
  376.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1 )
  377.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  378.  
  379.     PORT_START                       /* IN1 player 2 controls */
  380.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2 )
  381.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2 )
  382.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
  383.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2 )
  384.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  385.  
  386.     PORT_START                       /* IN2 dip switch */
  387.     PORT_DIPNAME( 0x03, 0x03, "Game Time" )
  388.     PORT_DIPSETTING(    0x00, "60 seconds" )
  389.     PORT_DIPSETTING(    0x01, "90 seconds" )
  390.     PORT_DIPSETTING(    0x02, "120 seconds" )
  391.     PORT_DIPSETTING(    0x03, "180 seconds" )
  392.     PORT_BIT( 0x18, IP_ACTIVE_LOW, IPT_UNUSED )
  393.     PORT_DIPNAME( 0x20, 0x20, "Video Invert" )
  394.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  395.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  396.     PORT_DIPNAME( 0x40, 0x40, "Marker Size" )
  397.     PORT_DIPSETTING(    0x00, "Small" )
  398.     PORT_DIPSETTING(    0x40, "Large" )
  399.     PORT_DIPNAME( 0x80, 0x80, "Color Overlay" )
  400.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  401.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  402.  
  403.     PORT_START                       /* IN3 coinage & start */
  404.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) )
  405.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  406.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_1C ) )
  407.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
  408.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
  409.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
  410.     PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
  411.  
  412.     PORT_START                       /* IN4 player 1 + 2 buttons */
  413.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  414.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  415.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  416.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  417.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  418. INPUT_PORTS_END
  419.  
  420. INPUT_PORTS_START( medlanes )
  421.     PORT_START                       /* IN0 player 1 controls */
  422.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
  423.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
  424.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
  425.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
  426.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  427.  
  428.     PORT_START                       /* IN1 player 1 controls */
  429.     PORT_BITX(0x01, IP_ACTIVE_LOW, 0,"Hook Left", KEYCODE_Z, 0 )
  430.     PORT_BITX(0x02, IP_ACTIVE_LOW, 0,"Hook Right", KEYCODE_X, 0 )
  431.     PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED)
  432.  
  433.     PORT_START                       /* IN2 dip switch */
  434.     PORT_DIPNAME( 0x01, 0x01, "Game Timer" )
  435.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  436.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  437.     PORT_DIPNAME( 0x02, 0x02, "Time" )
  438.     PORT_DIPSETTING(    0x00, "3 seconds" )
  439.     PORT_DIPSETTING(    0x02, "5 seconds" )
  440.     PORT_BIT( 0x1C, IP_ACTIVE_LOW, IPT_UNUSED)
  441.     PORT_DIPNAME( 0x20, 0x00, "Video Invert" )
  442.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  443.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  444.     PORT_DIPNAME( 0x40, 0x00, "Marker Size" )
  445.     PORT_DIPSETTING(    0x00, "Small" )
  446.     PORT_DIPSETTING(    0x40, "Large" )
  447.     PORT_DIPNAME( 0x80, 0x00, "Color Overlay" )
  448.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  449.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  450.  
  451.     PORT_START                       /* IN3 coinage & start */
  452.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) )
  453.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  454.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_1C ) )
  455.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
  456.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
  457.     PORT_BIT( 0xf4, IP_ACTIVE_HIGH, IPT_UNUSED )
  458.     PORT_START                       /* IN4 not used */
  459.     PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
  460. INPUT_PORTS_END
  461.  
  462.  
  463. static struct GfxLayout charlayout =
  464. {
  465.     8, 10,                    /* 8*10 characters */
  466.     4*64,                    /* 4 * 64 characters */
  467.     1,                        /* 1 bit per pixel */
  468.     { 0 },                    /* no bitplanes */
  469.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  470.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 },
  471.     10*8                    /* every char takes 10 bytes */
  472. };
  473.  
  474. static struct GfxDecodeInfo gfxdecodeinfo[] =
  475. {
  476.     { REGION_GFX1, 0, &charlayout, 0, 2 },
  477.     { -1 }                   /* end of array */
  478. };
  479.  
  480.  
  481. /* some colors for the frontend */
  482. static unsigned char palette[] =
  483. {
  484. /*  Red Green Blue */
  485.     0x00,0x00,0x00,        /* black */
  486.     0xb0,0xb0,0xb0,        /* white */
  487.     0xff,0xff,0xff        /* bright white */
  488. };
  489. static unsigned short colortable[] =
  490. {
  491.      1, 0,
  492.      0, 1
  493. };
  494. static void init_palette(unsigned char *game_palette, unsigned short *game_colortable,const unsigned char *color_prom)
  495. {
  496.     memcpy(game_palette,palette,sizeof(palette));
  497.     memcpy(game_colortable,colortable,sizeof(colortable));
  498. }
  499.  
  500. static struct DACinterface lazercmd_DAC_interface =
  501. {
  502.     1,
  503.     { 100 }
  504. };
  505.  
  506. static struct MachineDriver machine_driver_lazercmd =
  507. {
  508. /* basic machine hardware */
  509.     {
  510.         {
  511.             CPU_S2650,
  512.             8064000/12/3,                 /* 672 kHz? */
  513. /*          Main Clock is 8Mhz divided by 12
  514.             but memory and IO access is only possible
  515.             within the line and frame blanking period
  516.             thus requiring an extra loading of approx 3-5 */
  517.             lazercmd_readmem, lazercmd_writemem, lazercmd_readport, lazercmd_writeport,
  518.             lazercmd_timer, 128        /* 7680 Hz */
  519.         }
  520.     },
  521.     /* frames per second, vblank duration (arbitrary values!) */
  522.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,
  523.     1,            /* single CPU, no need for interleaving */
  524.     0,
  525.  
  526. /* video hardware */
  527.     HORZ_RES * HORZ_CHR, VERT_RES * VERT_CHR,
  528.     {0 * HORZ_CHR, HORZ_RES * HORZ_CHR - 1,
  529.      0 * VERT_CHR, (VERT_RES - 1) * VERT_CHR - 1},
  530.  
  531.     gfxdecodeinfo,
  532.     3+32768, 2*2,        /* extra color for the overlay */
  533.     init_palette,
  534.  
  535.     VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY | VIDEO_MODIFIES_PALETTE,
  536.     0,
  537.     lazercmd_vh_start,
  538.     generic_vh_stop,
  539.     lazercmd_vh_screenrefresh,
  540.  
  541. /* sound hardware */
  542.     0, 0, 0, 0,
  543.     {
  544.         {
  545.             SOUND_DAC,
  546.             &lazercmd_DAC_interface
  547.         }
  548.     }
  549. };
  550.  
  551. static struct MachineDriver machine_driver_medlanes =
  552. {
  553. /* basic machine hardware */
  554.     {
  555.         {
  556.             CPU_S2650,
  557.             8064000/12/3,                 /* 672 kHz? */
  558. /*          Main Clock is 8Mhz divided by 12
  559.             but memory and IO access is only possible
  560.             within the line and frame blanking period
  561.             thus requiring an extra loading of approx 3-5 */
  562.             medlanes_readmem, medlanes_writemem, lazercmd_readport, lazercmd_writeport,
  563.             lazercmd_timer, 128        /* 7680 Hz */
  564.         }
  565.     },
  566.     /* frames per second, vblank duration (arbitrary values!) */
  567.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,
  568.     1,            /* single CPU, no need for interleaving */
  569.     0,
  570.  
  571. /* video hardware */
  572.     HORZ_RES * HORZ_CHR, VERT_RES * VERT_CHR,
  573.     {0 * HORZ_CHR, HORZ_RES * HORZ_CHR - 1,
  574.      0 * VERT_CHR, VERT_RES * VERT_CHR - 1},
  575.  
  576.     gfxdecodeinfo,
  577.     3+32768, 2*2,        /* extra color for the overlay */
  578.     init_palette,
  579.  
  580.     VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY | VIDEO_MODIFIES_PALETTE,
  581.     0,
  582.     lazercmd_vh_start,
  583.     generic_vh_stop,
  584.     lazercmd_vh_screenrefresh,
  585.  
  586. /* sound hardware */
  587.     0, 0, 0, 0,
  588.     {
  589.         {
  590.             SOUND_DAC,
  591.             &lazercmd_DAC_interface
  592.         }
  593.     }
  594. };
  595.  
  596. /***************************************************************************
  597.  
  598.   Game driver(s)
  599.  
  600. ***************************************************************************/
  601.  
  602. ROM_START( lazercmd )
  603.     ROM_REGION( 0x8000, REGION_CPU1 )               /* 32K cpu, 4K for ROM/RAM */
  604.     ROM_LOAD( "lc.e5",        0x0000, 0x0400, 0x56dc7a40 )
  605.     ROM_LOAD( "lc.e6",        0x0400, 0x0400, 0xb1ef0aa2 )
  606.     ROM_LOAD( "lc.e7",        0x0800, 0x0400, 0x8e6ffc97 )
  607.     ROM_LOAD( "lc.f5",        0x1000, 0x0400, 0xfc5b38a4 )
  608.     ROM_LOAD( "lc.f6",        0x1400, 0x0400, 0x26eaee21 )
  609.     ROM_LOAD( "lc.f7",        0x1800, 0x0400, 0x9ec3534d )
  610.  
  611.     ROM_REGION( 0x0c00, REGION_GFX1 | REGIONFLAG_DISPOSE )
  612.     ROM_LOAD( "lc.b8",        0x0a00, 0x0200, 0x6d708edd )
  613. ROM_END
  614.  
  615. ROM_START( medlanes )
  616.     ROM_REGION( 0x8000, REGION_CPU1 )               /* 32K cpu, 4K for ROM/RAM */
  617.     ROM_LOAD( "medlanes.2a", 0x0000, 0x0400, 0x9c77566a )
  618.     ROM_LOAD( "medlanes.2b", 0x0400, 0x0400, 0x7841b1a9 )
  619.     ROM_LOAD( "medlanes.2c", 0x0800, 0x0400, 0xa359b5b8 )
  620.     ROM_LOAD( "medlanes.1a", 0x1000, 0x0400, 0x0d57c596 )
  621.     ROM_LOAD( "medlanes.1b", 0x1400, 0x0400, 0x1d451630 )
  622.     ROM_LOAD( "medlanes.3a", 0x4000, 0x0400, 0x22bc56a6 )
  623.     ROM_LOAD( "medlanes.3b", 0x4400, 0x0400, 0x6616dbef )
  624.     ROM_LOAD( "medlanes.3c", 0x4800, 0x0400, 0xb3db0f3d )
  625.     ROM_LOAD( "medlanes.4a", 0x5000, 0x0400, 0x30d495e9 )
  626.     ROM_LOAD( "medlanes.4b", 0x5400, 0x0400, 0xa4abb5db )
  627.  
  628.     ROM_REGION( 0x0c00, REGION_GFX1 | REGIONFLAG_DISPOSE )
  629.     ROM_LOAD( "medlanes.8b", 0x0a00, 0x0200, 0x44e5de8f )
  630. ROM_END
  631.  
  632.  
  633.  
  634. void init_lazercmd(void)
  635. {
  636. int i, y;
  637.  
  638. /******************************************************************
  639.  * The ROMs are 1K x 4 bit, so we have to mix
  640.  * them into 8 bit bytes. The data is also inverted.
  641.  ******************************************************************/
  642.     for (i = 0; i < 0x0c00; i++)
  643.     {
  644.         memory_region(REGION_CPU1)[i + 0x0000] =
  645.             ((memory_region(REGION_CPU1)[i + 0x0000] << 4) |
  646.              (memory_region(REGION_CPU1)[i + 0x1000] & 15)) ^ 0xff;
  647.     }
  648. /******************************************************************
  649.  * To show the maze bit #6 and #7 of the video ram are used.
  650.  * Bit #7: add a vertical line to the right of the character
  651.  * Bit #6: add a horizontal line below the character
  652.  * The video logic generates 10 lines per character row, but the
  653.  * character generator only contains 8 rows, so we expand the
  654.  * font to 8x10.
  655.  ******************************************************************/
  656.     for (i = 0; i < 0x40; i++)
  657.     {
  658. unsigned char *d = &memory_region(REGION_GFX1)[0 * 64 * 10 + i * VERT_CHR];
  659. unsigned char *s = &memory_region(REGION_GFX1)[4 * 64 * 10 + i * VERT_FNT];
  660.  
  661.         for (y = 0; y < VERT_CHR; y++)
  662.         {
  663.             d[0*64*10] = (y < VERT_FNT) ? *s++ : 0xff;
  664.             d[1*64*10] = (y == VERT_CHR - 1) ? 0 : *d;
  665.             d[2*64*10] = *d & 0xfe;
  666.             d[3*64*10] = (y == VERT_CHR - 1) ? 0 : *d & 0xfe;
  667.             d++;
  668.         }
  669.     }
  670. }
  671.  
  672. void init_medlanes(void)
  673. {
  674. int i, y;
  675.  
  676. /******************************************************************
  677.  * The ROMs are 1K x 4 bit, so we have to mix
  678.  * them into 8 bit bytes. The data is also inverted.
  679.  ******************************************************************/
  680.     for (i = 0; i < 0x4000; i++)
  681.     {
  682.         memory_region(REGION_CPU1)[i + 0x0000] =
  683.             ~((memory_region(REGION_CPU1)[i + 0x0000] << 4) |
  684.               (memory_region(REGION_CPU1)[i + 0x4000] & 15));
  685.     }
  686. /******************************************************************
  687.  * To show the maze bit #6 and #7 of the video ram are used.
  688.  * Bit #7: add a vertical line to the right of the character
  689.  * Bit #6: add a horizontal line below the character
  690.  * The video logic generates 10 lines per character row, but the
  691.  * character generator only contains 8 rows, so we expand the
  692.  * font to 8x10.
  693.  ******************************************************************/
  694.     for (i = 0; i < 0x40; i++)
  695.     {
  696. unsigned char *d = &memory_region(REGION_GFX1)[0 * 64 * 10 + i * VERT_CHR];
  697. unsigned char *s = &memory_region(REGION_GFX1)[4 * 64 * 10 + i * VERT_FNT];
  698.  
  699.         for (y = 0; y < VERT_CHR; y++)
  700.         {
  701.             d[0*64*10] = (y < VERT_FNT) ? *s++ : 0xff;
  702.             d[1*64*10] = (y == VERT_CHR - 1) ? 0 : *d;
  703.             d[2*64*10] = *d & 0xfe;
  704.             d[3*64*10] = (y == VERT_CHR - 1) ? 0 : *d & 0xfe;
  705.             d++;
  706.         }
  707.     }
  708. }
  709.  
  710.  
  711.  
  712. GAME( 1976, lazercmd, 0, lazercmd, lazercmd, lazercmd, ROT0, "Meadows Games, Inc.", "Lazer Command" )
  713. GAME( 1977, medlanes, 0, medlanes, medlanes, medlanes, ROT0, "Meadows Games, Inc.", "Meadows Lanes" )
  714.